import TSMap from "../../../cfw/struct/TSMap";
import BaseAction from "./BaseAction";
import { ActionType } from "../../../public/Config";
import ActionFactory from "./ActionFactory";
import ChangeActionView from "../view/ChangeActionView";

export default class ActionManager {

    protected actions: TSMap<number, BaseAction> = new TSMap()
    protected player: ChangeActionView;

    set self(p: ChangeActionView) {
        this.player = p;
    }
    start(type: ActionType, param?) {
        let action = this.actions.get(type)
        if (!action) {
            action = ActionFactory.builder(type)
            action.self = this.player;
        }
        cc.log(' ActionManager ',type)
        action.start(param)
    }


}
